package com.cqie.studentserver.controller;

import com.cqie.studentserver.properties.PatternProperties;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @Author Zhangr132
 * @date 2024/5/29
 */
@RestController
@Api(tags = "学生管理")
@Slf4j
public class TestController {
    @Resource
    private PatternProperties patternProperties;

    @GetMapping("/studentTest")
    @ApiOperation("学生测试接口")
    public String test() {
        log.info("学生服务调用。。。。。。");
        return "student-server test success";
    }

    @GetMapping("/now")
    @ApiOperation("获取demo服务器当前时间")
    public String now(){
        return LocalDateTime.now().format(DateTimeFormatter.ofPattern(patternProperties.getDateformat()));
    }
}
